package com.software.chemistry.service.Impl;

import com.software.chemistry.entity.ModelType;
import com.software.chemistry.repository.ModelTypeRepository;
import com.software.chemistry.service.ModelTypeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;
import org.springframework.stereotype.Service;

import javax.swing.*;
import java.util.List;
@Service
public class ModelTypeServiceImpl implements ModelTypeService {

    @Autowired
    private ModelTypeRepository modelTypeRepository;
    @Override
    public List<ModelType> findAll() {
        List<ModelType> modelTypes = modelTypeRepository.findAll();
        return modelTypes;
    }

    @Override
    public List<ModelType> findCommonModelType() {
        PageRequest pageRequest = PageRequest.of(0,14);
        Page<ModelType> page = modelTypeRepository.findAll(pageRequest);
        List<ModelType> modelTypes = page.getContent();
        return modelTypes;
    }


}
